package com.dai.zhenfujin.issue.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.dai.zhenfujin.R;
import com.dai.zhenfujin.issue.bean.AddRoomBean;

import java.util.List;

public class AddAdapter extends BaseAdapter {
    private Context context;
    private List<AddRoomBean> beans;
    private LayoutInflater inflater;


    public AddAdapter(Context context, List<AddRoomBean> beans) {
        this.context = context;
        this.beans = beans;
        inflater = LayoutInflater.from(context);
    }


    @Override
    public int getCount() {
        return beans.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if(convertView == null){
            holder = new ViewHolder();
            convertView = View.inflate(context,R.layout.item_listview_add,null);
            holder.tvName = convertView.findViewById(R.id.item_listview_add_name);

            convertView.setTag(holder);
        }else {
            holder = (ViewHolder) convertView.getTag();
        }


        AddRoomBean bean = beans.get(position);
        holder.tvName.setText(bean.getName());


        return convertView;
    }

    class ViewHolder{
        private TextView tvName;
    }
}
